/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.cibertec.dawii.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Manuel Eguiluz
 */
@Entity
@Table(name = "support_staff", catalog = "uservoice", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SupportStaff.findAll", query = "SELECT s FROM SupportStaff s"),
    @NamedQuery(name = "SupportStaff.findById", query = "SELECT s FROM SupportStaff s WHERE s.id = :id"),
    @NamedQuery(name = "SupportStaff.findByDateJoined", query = "SELECT s FROM SupportStaff s WHERE s.dateJoined = :dateJoined"),
    @NamedQuery(name = "SupportStaff.findByDateLeft", query = "SELECT s FROM SupportStaff s WHERE s.dateLeft = :dateLeft"),
    @NamedQuery(name = "SupportStaff.findByName", query = "SELECT s FROM SupportStaff s WHERE s.name = :name"),
    @NamedQuery(name = "SupportStaff.findByPhone", query = "SELECT s FROM SupportStaff s WHERE s.phone = :phone"),
    @NamedQuery(name = "SupportStaff.findByEmail", query = "SELECT s FROM SupportStaff s WHERE s.email = :email"),
    @NamedQuery(name = "SupportStaff.findByLocation", query = "SELECT s FROM SupportStaff s WHERE s.location = :location")})
public class SupportStaff implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "date_joined", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateJoined;
    @Basic(optional = false)
    @Column(name = "date_left", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateLeft;
    @Basic(optional = false)
    @Column(nullable = false, length = 45)
    private String name;
    @Basic(optional = false)
    @Column(nullable = false, length = 15)
    private String phone;
    @Basic(optional = false)
    @Column(nullable = false, length = 80)
    private String email;
    @Basic(optional = false)
    @Column(nullable = false, length = 255)
    private String location;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "supportStaff1")
    private Collection<StaffSkill> staffSkillCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "assignedStaff")
    private Collection<ProblemHistory> problemHistoryCollection;

    public SupportStaff() {
    }

    public SupportStaff(Integer id) {
        this.id = id;
    }

    public SupportStaff(Integer id, Date dateJoined, Date dateLeft, String name, String phone, String email, String location) {
        this.id = id;
        this.dateJoined = dateJoined;
        this.dateLeft = dateLeft;
        this.name = name;
        this.phone = phone;
        this.email = email;
        this.location = location;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDateJoined() {
        return dateJoined;
    }

    public void setDateJoined(Date dateJoined) {
        this.dateJoined = dateJoined;
    }

    public Date getDateLeft() {
        return dateLeft;
    }

    public void setDateLeft(Date dateLeft) {
        this.dateLeft = dateLeft;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @XmlTransient
    public Collection<StaffSkill> getStaffSkillCollection() {
        return staffSkillCollection;
    }

    public void setStaffSkillCollection(Collection<StaffSkill> staffSkillCollection) {
        this.staffSkillCollection = staffSkillCollection;
    }

    @XmlTransient
    public Collection<ProblemHistory> getProblemHistoryCollection() {
        return problemHistoryCollection;
    }

    public void setProblemHistoryCollection(Collection<ProblemHistory> problemHistoryCollection) {
        this.problemHistoryCollection = problemHistoryCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SupportStaff)) {
            return false;
        }
        SupportStaff other = (SupportStaff) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.cibertec.dawii.entity.SupportStaff[ id=" + id + " ]";
    }
    
}
